<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="Stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css"/>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-1.11.3.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
</head>
<style>
#div1{
display: none;
position: absolute;
left:50%;
top:50%;
width:250px;

height:150px;

background-color:gray;

text-align: center;

}
#open{
position: absolute;
width:100px;
height:50px;
}

</style>
<script>
function OpenDiv(){
document.getElementById("div1").style.display="block";
}
function CloseDiv(){
document.getElementById("div1").style.display="none";
}

</script>

<script>

function load(){
	 $.getJSON("getMessages",{"fromUserId":2,"toUserId":1},function(data){
		 var html="<table  border='1'><tr><td>留言者</td><td>留言者</td><td>留言者</td></tr>";
		 $.each(data,function(i,item){
			 html+="<tr>";
			 html+=" <td>"+item["id"]+"</td>";
			 html+="<td>"+item["content"]+"</td>";
			 html+="<td>"+item["content"]+"</td>"		 
			 html+="</tr></table>"
		 })					 
		 $("#neirong").html(html);
	 });

	 $(function(){
		 $("#dainji").click(
				 load()	 
		 )
	 });	 
}

$(function(){
	$("#tarenliuyan").click(function(){
		alert($("#fromUserId").val());	
		$.get("xiaoxi",{"fromUserId":$("#fromUserId").val()}, function(data){
			  var html="<li><a href='userRemove' style='line-height:35px;'>他人留言";
			  var num=0;
			  $.each(data,function(i,item){
				 if(item["isRead"]==false){
					 num++;					
				 }	
				 html+="他人留言(未读"+num+")</a></li>"
				 alert(html);
			  $("#test").html(html);
			});
						
		})
	});	
});




</script>
<body>
<input type="hidden" id="fromUserId" value="${user==null?0:user.id}" />
  <li><a href="#" style="line-height:35px;">他人留言</a></li>
  <input id="tarenliuyan" type="button" value="留言" />
<a href="" id="download" onclick="">下载 sfsf</a>
	<div class="row">
		<div class="col-md-2">
			<h1>留言内容主体</h1>	
			<table  border="1">
				<tr>
					<td>留言者</td>
					<td>留言者</td>
					<td>留言者</td>
				</tr>
				<c:forEach items="${messagelist}" var="m" varStatus="status">
					<tr>
						<td>${m.fromUser.username}</td>
						<td>${m.content}</td>
						<td><fmt:formatDate pattern="yyyy-MM-dd HH:mm:ss" value="${m.createTime}"/></td>
					</tr>
				</c:forEach>
			</table>
		
		</div>
	</div>
	<hr/>
	<div>	
			内容：<input type="text" name="url" /> <input id="btnAdd" type="button" value="发送" />

	</div>
	
	<div id="test">
	
	</div>


</body>
</html>